// packageJ/anytime_service/my/record/record.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    active: "1",
    list: [],
    name: "",
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.setData({
      name: options.name || ''
    })
    this.get_data();
  },

  onClick(e) {
    this.setData({active:e.detail.name});
    this.get_data();
  },
  goto() {
    if (this.data.name == 'skill_master') {
      let urlStr = '/packageJ/anytime_service/my/role_apply_for/master_worker/master_worker?apply_type=2';
      if(this.data.active==0){
        urlStr = '/packageJ/anytime_service/my/role_apply_for/master_worker/master_worker?apply_type=2&apply_status=0'
      }
      wx.navigateTo({url:urlStr});
    } else {
      wx.navigateTo({
        url: '/packageJ/anytime_service/my/role_apply_for/promulgator/promulgator', //发布者
      })
    }
  },
  get_data() {
    let json = {
      identity: this.data.name == 'skill_master' ? 2 : 1,
      status: this.data.active
    }
    app._getNetWork({
      url: app.getNetAddresss("plugin.be-within-call.frontend.role-apply.log"),
      data: json,
      success: resdata => {
        let {
          result,
          data,
          msg
        } = resdata.data;
        if (result) {
          this.setData({
            list:data
          })
        } else {
          app.tips(msg);
        }
      }
    })

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})